import http from '@/libs/httpRequest'

// 管理员
// 用户管理初始化表格数据
export const getUsersList = params => {
  // const data = new FormData()
  // const key = Object.keys(params)
  // key.forEach(item => {
  //   data.append(item, params[item])
  // })
  return http({
    url: http.adornUrl('sys/queryUser'),
    method: 'post',
    data: http.adornData(params)
  })
}
// 用户管理新增修改用户
export const addUser = params => {
  return http({
    url: http.adornUrl('sys/registerUser'),
    method: 'post',
    data: http.adornData(params)
  })
}
// 上传头像
export const uploadPhoto = data => {
  return http({
    url: http.adornUrl('sys/uploadPhoto'),
    method: 'post',
    data: data
  })
}
// 删除用户
export const removeUser = id => {
  const data = new FormData()
  data.append('userId', id)
  return http({
    url: http.adornUrl('sys/deleteUser'),
    method: 'post',
    data: data
  })
}
// 修改用户
export const updateUser = params => {
  return http({
    url: http.adornUrl('sys/updateUser'),
    method: 'post',
    data: http.adornData(params)
  })
}

// 检查用户是否注册
export const queryCheckUser = loginName => {
  const data = new FormData()
  data.append('loginName', loginName)
  return http({
    url: http.adornUrl('sys/queryCheckUser'),
    method: 'post',
    data: data
  })
}

// 问卷
// 直播页获取问卷id,参数课程id（courseId）数字
export const queryQuestionnairesId = params => {
  return http({
    url: http.adornUrl('questionnaires/queryQuestionnaireId'),
    method: 'post',
    data: http.adornData(params)
  })
}
// 查
export const queryQuestionnaires = params => {
  return http({
    url: http.adornUrl('questionnaires/queryQuestionnaires'),
    method: 'post',
    data: http.adornData(params)
  })
}
// 删
export const deleteQuestionnaires = params => {
  return http({
    url: http.adornUrl('questionnaires/deleteQuestionnaires'),
    method: 'post',
    data: http.adornData(params)
  })
}
// 问卷新增
export const addQuestionnaires = params => {
  return http({
    url: http.adornUrl('questionnaires/addQuestionnaires'),
    method: 'post',
    data: http.adornData(params)
  })
}
// 获取问卷信息
export const getJointcaseQuestionnaireInfo = () => {
  return http({
    url: http.adornUrl('jointcasestudy/getQuestionnaireInfo'),
    method: 'get'
  })
}

// 问卷详情,查看问卷答案，参数问卷id和答题人id
export const queryQuestionnaireInfo = params => {
  return http({
    url: http.adornUrl('questionnaires/queryQuestionnaireInfo'),
    method: 'post',
    data: http.adornData(params)
  })
}

// 提交问卷答案
export const submitAnswer = params => {
  return http({
    url: http.adornUrl('answers/addAnswers'),
    method: 'post',
    data: http.adornData(params)
  })
}
// 查看问卷答案，参数问卷id和答题人id
export const getAnswerDetail = params => {
  return http({
    url: http.adornUrl('answers/queryAnswerInfo'),
    method: 'post',
    data: http.adornData(params)
  })
}
// 教学直播开课
// 教学直播获取课程信息
export const getCourseInfo = params => {
  return http({
    url: http.adornUrl('queryCourse/queryCourse'),
    method: 'post',
    data: http.adornData(params)
  })
}
// 删
export const deleteCourse = params => {
  return http({
    url: http.adornUrl('queryCourse/deleteCourse?courseId=' + params),
    method: 'post'
    // data: http.adornData(params)
  })
}
// 开始结束上课
export const updateCourse = params => {
  return http({
    url: http.adornUrl('queryCourse/updateCourse'),
    method: 'post',
    data: http.adornData(params)
  })
}

// 教学直播获取教师信息
export const getTeachersInfo = () => {
  return http({
    url: http.adornUrl('livebroadcastteach/getTeachersInfo'),
    method: 'get'
  })
}
// 教学直播获取问卷信息
export const getQuestionnaireInfo = () => {
  return http({
    url: http.adornUrl('livebroadcastteach/getQuestionnaireInfo'),
    method: 'get'
  })
}
// 教学直播保存新课程
export const saveNewCourseInfo = params => {
  return http({
    url: http.adornUrl('livebroadcastteach/saveNewCourseInfo'),
    method: 'post',
    data: http.adornData(params)
  })
}
// 教学直播更新课程状态
export const updateOldCourseStatus = params => {
  return http({
    url: http.adornUrl('livebroadcastteach/updateOldCourseStatus'),
    method: 'get',
    params: http.adornParams(params)
  })
}

// 案例联席开课
// 获取课程信息
export const getJointcaseCourseInfo = () => {
  return http({
    url: http.adornUrl('jointcasestudy/getCourseInfo'),
    method: 'get'
  })
}
// 获取教师信息
export const getJointcaseTeachersInfo = () => {
  return http({
    url: http.adornUrl('jointcasestudy/getTeachersStudentsInfo'),
    method: 'get'
  })
}

// 保存新课程
export const saveJointcaseNewCourseInfo = params => {
  return http({
    url: http.adornUrl('jointcasestudy/saveNewCourseInfo'),
    method: 'post',
    data: http.adornData(params)
  })
}
// 更新课程状态
export const updateJointOldCourseStatus = params => {
  return http({
    url: http.adornUrl('/jointcasestudy/updateOldCourseStatus'),
    method: 'get',
    params: http.adornParams(params)
  })
}

// 直播成果管理
export const queryTeachingResultsManage = params => {
  return http({
    url: http.adornUrl('resourcesDemand/queryResourcesDemand'),
    method: 'post',
    data: http.adornData(params)
  })
}
// 直播修改投放状态
export const updateTeachingResultsManage = params => {
  return http({
    url: http.adornUrl('resourcesDemand/updateResourcesDemand'),
    method: 'post',
    data: http.adornData(params)
  })
}
// 直播成果管理删除
export const deleteTeachingResultsManage = params => {
  return http({
    url: http.adornUrl('resourcesDemand/deleteResourcesDemand'),
    method: 'post',
    data: http.adornData(params)
  })
}
export const teacherDeleteTeachingResultsManage = params => {
  return http({
    url: http.adornUrl(
      'teachingResultsManage/deleteTeachingResultsManage?courseId=' + params
    ),
    method: 'post'
    // data: http.adornData(params)
  })
}

// 直播成果管理
export const queryTeachingResult = params => {
  return http({
    url: http.adornUrl('teachingResultsManage/queryTeachingResult'),
    method: 'post',
    data: http.adornData(params)
  })
}
// 管理员直播成果管理
export const adminQueryTeachingResultsManage = params => {
  return http({
    url: http.adornUrl('teachingResultsManage/queryTeachingResultsManage'),
    method: 'post',
    data: http.adornData(params)
  })
}
// 投放状态改变
export const adminUpdateTeachingResultsManage = params => {
  return http({
    url: http.adornUrl('teachingResultsManage/updateTeachingResultsManage'),
    method: 'post',
    data: http.adornData(params)
  })
}
// 删除
export const adminDeleteTeachingResultsManage = params => {
  return http({
    url: http.adornUrl(
      'teachingResultsManage/deleteTeachingResultsManage?courseId=' + params
    ),
    method: 'post'
    // data: http.adornData(params)
  })
}
// 评分项管理
// 查询
export const queryContentEvaluation = params => {
  return http({
    url: http.adornUrl('contentEvaluation/queryContentEvaluation'),
    method: 'post',
    data: http.adornData(params)
  })
}
// 插入
export const addContentEvaluation = params => {
  return http({
    url: http.adornUrl('contentEvaluation/addContentEvaluation'),
    method: 'post',
    data: http.adornData(params)
  })
}
// 修改评分内容
export const updateContentEvaluation = params => {
  return http({
    url: http.adornUrl('contentEvaluation/updateContentEvaluation'),
    method: 'post',
    data: http.adornData(params)
  })
}

// 删除评分内容
export const deleteContentEvaluation = params => {
  return http({
    url: http.adornUrl('contentEvaluation/deleteContentEvaluation'),
    method: 'post',
    data: http.adornData(params)
  })
}

// 弹幕管理
export const getbarragemessage = params => {
  return http({
    url: http.adornUrl('teachingResultsManage/getbarragemessage'),
    method: 'post',
    data: http.adornData(params)
  })
}
// 删除弹幕
export const delBarrageMessage = params => {
  return http({
    url: http.adornUrl('teachingResultsManage/delBarrageMessage?messageId='+params),
    method: 'post',
    // data: http.adornData(params)
  })
}


